import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        //allMenuTree: [],
        //allRole:[],
        //菜单列表和角色绑定菜单的位置会用到
        deptTree:[{childDept:[]}],
        //用户绑定岗位列表会用到
        jobDatas:[],
        //用户绑定角色列表会用到
        roleDatas:[],
        authList:[],
        routerNameMap:{},
        routerButtonMap:{},
        dictMap:{}
    },
    mutations: {
        putDeptTree(state, data) {
            state.deptTree = data
        },

        putRoleDatas(state, data) {
            state.roleDatas = data
        },

        putJobDatas(state, data) {
            state.jobDatas = data
        },

        putAuthList(state, data) {
            state.authList = data
        },

        putRouterButtonMap(state, data) {
            state.routerButtonMap = data
        },

        putRouterNameMap(state, data) {
            state.routerNameMap = data
        },

        putDictMap(state, data) {
            state.dictMap = data
        }
    },

    actions: {

        putDeptTree(context,data) {
            context.commit('putDeptTree',data)
        },

        putRoleDatas(context,data) {
            context.commit('putRoleDatas',data)
        },

        putJobDatas(context, data) {
            context.commit('putJobDatas',data)
        },

        putAuthList(context, data) {
            context.commit('putAuthList',data)
        },

        putRouterButtonMap(context, data) {
            context.commit('putRouterButtonMap',data)
        },

        putRouterNameMap(context, data) {
            context.commit('putRouterNameMap',data)
        },

        putDictMap(context, data) {
            context.commit('putDictMap',data)
        }

    },
    modules: {}
})